import {
  addCountApi,
  addIndexCountApi,
  addPlatformApi,
  addStoreApi,
  authStoreApi,
  classifyAddIndexGetApi,
  classifyAddIndexPostApi,
  classifyDeleteApi,
  classifyDetailApi,
  classifyListApi,
  classifyPostApi,
  collectionStoreApi,
  commonCityApi,
  cooperationPlatformDeleteApi,
  cooperationPlatformDetailApi,
  delAdvertisementApi,
  deleteAdApi,
  getAccessTokenAPi,
  getAdApi,
  getAdListApi,
  getCollectionApi,
  getPhoneApi,
  getPlatformApi,
  getPlatformCountApi,
  getQrCodeApi,
  getStoreAPi,
  getStoreDetailApi,
  getStoreViewCountApi,
  getToolApi,
  getUserInfoApi,
  getWxCodeApi,
  indexFindApi,
  indexGetDetailApi,
  insertAdApi,
  storeBizApi,
  storeDeleteApi,
  storeDisableApi,
  talkDeleteApi,
  talkGetApi,
  talkPostApi,
  updateAdApi,
  useInfoApi,
  wxLoginApi,
} from "../api/all";

/**
 * 获取省市区
 */
export const commonCity = () => {
  return new Promise((resolve, reject) => {
    commonCityApi()
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 获取首页广告
 */
export const classifyAddIndexGet = () => {
  return new Promise((resolve, reject) => {
    classifyAddIndexGetApi()
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 获得全部分类
 */
export const classifyList = (params: any) => {
  return new Promise((resolve, reject) => {
    classifyListApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 删除分类
 */
export const classifyDelete = (params: any) => {
  return new Promise((resolve, reject) => {
    classifyDeleteApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 获取分类详情
 */
export const classifyDetail = (params: any) => {
  return new Promise((resolve, reject) => {
    classifyDetailApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 添加分类
 */
export const classifyPost = (params: any) => {
  return new Promise((resolve, reject) => {
    classifyPostApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 获取工具列表
 */
export const getTool = (params: any) => {
  return new Promise((resolve, reject) => {
    getToolApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 获取动态
 */
export const talkGet = (params: any) => {
  return new Promise((resolve, reject) => {
    talkGetApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 获取合作平台
 */
export const getPlatform = (params: any) => {
  return new Promise((resolve, reject) => {
    getPlatformApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const cooperationPlatformDelete = (params: any) => {
  return new Promise((resolve, reject) => {
    cooperationPlatformDeleteApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const cooperationPlatformDetail = (params: any) => {
  return new Promise((resolve, reject) => {
    cooperationPlatformDetailApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const addPlatform = (params: any) => {
  return new Promise((resolve, reject) => {
    addPlatformApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 新增动态
 */
export const talkPost = (params: any) => {
  return new Promise((resolve, reject) => {
    talkPostApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
/**
 * 删除动态
 */
export const talkDelete = (params: any) => {
  return new Promise((resolve, reject) => {
    talkDeleteApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const addCount = (params: any) => {
  return new Promise((resolve, reject) => {
    addCountApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const indexGetDetail = (params: any) => {
  return new Promise((resolve, reject) => {
    indexGetDetailApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const addIndex = () => {
  return new Promise((resolve, reject) => {
    addIndexCountApi()
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const useInfo = (params: any) => {
  return new Promise((resolve, reject) => {
    useInfoApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const wxLogin = (params: any) => {
  return new Promise((resolve, reject) => {
    wxLoginApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const classifyAddIndexPost = (params: any) => {
  return new Promise((resolve, reject) => {
    classifyAddIndexPostApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getPhone = (params: any) => {
  return new Promise((resolve, reject) => {
    getPhoneApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const authStore = (params: any) => {
  return new Promise((resolve, reject) => {
    authStoreApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const deleteAd = (params: any) => {
  return new Promise((resolve, reject) => {
    deleteAdApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const insertAd = (params: any) => {
  return new Promise((resolve, reject) => {
    insertAdApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getAd = () => {
  return new Promise((resolve, reject) => {
    getAdApi()
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getAdList = () => {
  return new Promise((resolve, reject) => {
    getAdListApi()
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const updateAd = (params: any) => {
  return new Promise((resolve, reject) => {
    updateAdApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getQrCode = (params: any) => {
  return new Promise((resolve, reject) => {
    getQrCodeApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getPlatformCount = () => {
  return new Promise((resolve, reject) => {
    getPlatformCountApi()
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getCollection = (params: any) => {
  return new Promise((resolve, reject) => {
    getCollectionApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getUserInfo = (params: any) => {
  return new Promise((resolve, reject) => {
    getUserInfoApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const storeDelete = (params: any) => {
  return new Promise((resolve, reject) => {
    storeDeleteApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getStore = (params: any) => {
  return new Promise((resolve, reject) => {
    getStoreAPi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const indexFind = (params: any) => {
  return new Promise((resolve, reject) => {
    indexFindApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getAccessToken = (params: any) => {
  return new Promise((resolve, reject) => {
    getAccessTokenAPi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getWxCode = (token: string, params: any) => {
  return new Promise((resolve, reject) => {
    getWxCodeApi(token, params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getStoreViewCount = (params: any) => {
  return new Promise((resolve, reject) => {
    getStoreViewCountApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const collectionStore = (params: any) => {
  return new Promise((resolve, reject) => {
    collectionStoreApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const storeDisable = (params: any) => {
  return new Promise((resolve, reject) => {
    storeDisableApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const addStore = (params: any) => {
  return new Promise((resolve, reject) => {
    addStoreApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const getStoreDetail = (params: any) => {
  return new Promise((resolve, reject) => {
    getStoreDetailApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const storeBiz = (params: any) => {
  return new Promise((resolve, reject) => {
    storeBizApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export const delAdvertisement = (params: any) => {
  return new Promise((resolve, reject) => {
    delAdvertisementApi(params)
      .then((res: any) => {
        resolve(res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
